#ifndef GETCONF_H
#define GETCONF_H

typedef struct config config_t;

/*
 * config itself can be looked as a map, with a key, we can
 * get a value. It is also a recursive structure, which means 
 * config can hold another config.
 *
 * So with a key, you can get:
 *  a string
 *  a integer
 *  a double
 *  another config
 * */

config_t * conf_create(const char *config_file_path);
void conf_destroy(config_t *cfg);
int conf_get_float(const config_t *config, const char *key, double *value);
int conf_get_integer(const config_t *config, const char *key, int *value);
int conf_get_string(const config_t *config, const char *key, char *value);
int conf_get_sub_config(const config_t *cfg, const char *key_name, config_t **value);
/*
 * for zipper file path configure, there should be a zipper_home
 * in configure file. As for other path item, if it's a relative
 * path, it will relative to zipper_home. so this function will 
 * always return the absolute path
 * */
int conf_get_path(const config_t *config, const char *key, char *value);

/*
 * all the configuration realted to bind is in another file
 * but configuration module will include it into the whole configuration
 * in this case, the global setting for the whole configuration like
 * zipper_home can take effect among different configure files
 * */
config_t *
conf_get_named_conf(const config_t *config);
#endif
